import{d as B,l as x,B as j,M as C,o as l,c as u,m as o,f as n,t as s,q as e,e as a,Q as pe,C as f,ax as D,a as m,b as k,w as r,F as y,p as E,G as _e,ay as H,H as fe,az as J,aA as W,K as Q,J as ve,E as be,aB as ze,_ as he}from"./index-c80Lh_is.js";import{C as h}from"./CodeBlock-BSWXsm4g.js";const ge={class:"form-step-title"},ke=o("span",{class:"form-step-number"},"1",-1),ye={class:"instruction-list"},Ce={href:"https://helm.sh/docs/intro/install/"},Ee={class:"form-step-title"},Ke=o("span",{class:"form-step-number"},"2",-1),Ve=o("p",null,"On your local machine, create a namespace in your Kubernetes cluster and pull down the kong Helm repo.",-1),$e={class:"instruction-list"},we={class:"form-step-title"},Ie=o("span",{class:"form-step-number"},"3",-1),Ne={class:"form-step-title"},Se=o("span",{class:"form-step-number"},"4",-1),Ze={class:"field-group-label mt-4"},Te={class:"mt-4"},Le=B({__name:"ZoneCreateKubernetesInstructions",props:{zoneName:{type:String,required:!0},globalKdsAddress:{type:String,required:!0},zoneIngressEnabled:{type:Boolean,required:!0},zoneEgressEnabled:{type:Boolean,required:!0},token:{type:String,required:!0},base64EncodedToken:{type:String,required:!0}},setup(I){const{t}=x(),g=j(),p=I,V=C(()=>t("zones.form.kubernetes.secret.createSecretCommand",{token:p.base64EncodedToken}).trim()),v=C(()=>{const b={zoneName:p.zoneName,globalKdsAddress:p.globalKdsAddress,zoneIngressEnabled:String(p.zoneIngressEnabled),zoneEgressEnabled:String(p.zoneEgressEnabled),controlPlaneId:typeof g.params.virtualControlPlaneId=="string"?g.params.virtualControlPlaneId:""};return t("zones.form.kubernetes.connectZone.config",b).trim()});return(b,$)=>(l(),u("div",null,[o("h3",ge,[ke,n(" "+s(e(t)("zones.form.kubernetes.prerequisites.title")),1)]),n(),o("ul",ye,[o("li",null,[o("b",null,s(e(t)("zones.form.kubernetes.prerequisites.step1Label"))+s(p.zoneIngressEnabled?" "+e(t)("zones.form.kubernetes.prerequisites.step1LabelAddendum"):""),1),n(`:
        `+s(e(t)("zones.form.kubernetes.prerequisites.step1Description",{productName:e(t)("common.product.name")})),1)]),n(),o("li",null,[o("b",null,s(e(t)("zones.form.kubernetes.prerequisites.step2Label")),1),n(`:
        `+s(e(t)("zones.form.kubernetes.prerequisites.step2Description")),1)]),n(),o("li",null,[o("a",Ce,s(e(t)("zones.form.kubernetes.prerequisites.step3LinkTitle")),1),n(" "+s(e(t)("zones.form.kubernetes.prerequisites.step3Tail")),1)])]),n(),o("h3",Ee,[Ke,n(" "+s(e(t)("zones.form.kubernetes.helm.title")),1)]),n(),Ve,n(),o("ol",$e,[o("li",null,[o("b",null,s(e(t)("zones.form.kubernetes.helm.step1Description")),1),n(),a(h,{class:"mt-2",code:e(t)("zones.form.kubernetes.helm.step1Command"),language:"bash"},null,8,["code"])]),n(),o("li",null,[o("b",null,s(e(t)("zones.form.kubernetes.helm.step2Description")),1),n(),a(h,{class:"mt-2",code:e(t)("zones.form.kubernetes.helm.step2Command"),language:"bash"},null,8,["code"])]),n(),o("li",null,[o("b",null,s(e(t)("zones.form.kubernetes.helm.step3Description")),1),n(),a(h,{class:"mt-2",code:e(t)("zones.form.kubernetes.helm.step3Command"),language:"bash"},null,8,["code"])])]),n(),o("h3",we,[Ie,n(" "+s(e(t)("zones.form.kubernetes.secret.title")),1)]),n(),o("p",null,s(e(t)("zones.form.kubernetes.secret.createSecretDescription")),1),n(),a(h,{class:"mt-4",code:V.value,language:"bash"},null,8,["code"]),n(),o("h3",Ne,[Se,n(" "+s(e(t)("zones.form.kubernetes.connectZone.title")),1)]),n(),o("p",null,s(e(t)("zones.form.kubernetes.connectZone.configDescription")),1),n(),o("span",Ze,s(e(t)("zones.form.kubernetes.connectZone.configFileName")),1),n(),a(h,{"data-testid":"zone-kubernetes-config",code:v.value,language:"yaml"},null,8,["code"]),n(),o("p",Te,s(e(t)("zones.form.kubernetes.connectZone.connectDescription")),1),n(),a(h,{class:"mt-4",code:e(t)("zones.form.kubernetes.connectZone.connectCommand").trim(),language:"bash"},null,8,["code"])]))}}),qe={class:"form-step-title"},Ae=o("span",{class:"form-step-number"},"1",-1),De={class:"form-step-title"},Be=o("span",{class:"form-step-number"},"2",-1),xe={class:"field-group-label mt-4"},Ue={class:"mt-4"},Re=B({__name:"ZoneCreateUniversalInstructions",props:{zoneName:{type:String,required:!0},globalKdsAddress:{type:String,required:!0},token:{type:String,required:!0}},setup(I){const{t}=x(),g=j(),p=I,V=C(()=>t("zones.form.universal.saveToken.saveTokenCommand",{token:p.token}).trim()),v=C(()=>{const b={zoneName:p.zoneName,globalKdsAddress:p.globalKdsAddress,controlPlaneId:typeof g.params.virtualControlPlaneId=="string"?g.params.virtualControlPlaneId:""};return t("zones.form.universal.connectZone.config",b).trim()});return(b,$)=>(l(),u("div",null,[o("h3",qe,[Ae,n(" "+s(e(t)("zones.form.universal.saveToken.title")),1)]),n(),o("p",null,s(e(t)("zones.form.universal.saveToken.saveTokenDescription")),1),n(),a(h,{class:"mt-4",code:V.value,language:"bash"},null,8,["code"]),n(),o("h3",De,[Be,n(" "+s(e(t)("zones.form.universal.connectZone.title")),1)]),n(),o("p",null,s(e(t)("zones.form.universal.connectZone.configDescription")),1),n(),o("span",xe,s(e(t)("zones.form.universal.connectZone.configFileName")),1),n(),a(h,{"data-testid":"zone-universal-config",class:"mt-4",code:v.value,language:"yaml"},null,8,["code"]),n(),o("p",Ue,s(e(t)("zones.form.universal.connectZone.connectDescription")),1),n(),a(h,{class:"mt-4",code:e(t)("zones.form.universal.connectZone.connectCommand").trim(),language:"bash"},null,8,["code"])]))}}),Pe={class:"form-wrapper"},Me={key:1},Oe={key:2},Fe={class:"form"},Xe={class:"form-header"},Ge={class:"form-title"},He={class:"text-gradient"},Je={key:0},We={key:0},Qe={class:"fact-list"},je={class:"form-section"},Ye={class:"form-section__header"},en={class:"form-section-title"},nn={class:"form-section__content"},on={class:"form-section","data-testid":"connect-zone-instructions"},tn={class:"form-section__header"},sn={class:"form-section-title"},an={class:"form-section__content"},ln={class:"field-group-list"},rn={class:"field-group"},cn={class:"field-group-label"},un={class:"radio-button-group"},dn={class:"field-group"},mn={class:"field-group-label"},pn={class:"radio-button-group","data-testid":"ingress-input-switch"},_n={class:"field-group"},fn={class:"field-group-label"},vn={class:"radio-button-group","data-testid":"egress-input-switch"},bn={class:"form-section"},zn={class:"form-section__header"},hn={class:"form-section-title"},gn={class:"form-section__content"},kn={class:"form-section"},yn={class:"form-section__header"},Cn={class:"form-section-title"},En={class:"form-section__content"},Kn={class:"mt-2"},Vn=B({__name:"ZoneCreateView",setup(I){const{t,tm:g}=x(),p=pe(),V=/^(?![-0-9])[a-z0-9-]{1,63}$/,v=f(null),b=f(!1),$=f(!1),_=f(null),N=f(null),T=f(""),U=f(!1),Y=f(new Date),d=f(""),K=f("kubernetes"),L=f(!0),q=f(!0),w=C(()=>v.value!==null&&v.value.token?v.value.token:""),ee=C(()=>w.value!==""?window.btoa(w.value):""),ne=C(()=>d.value===""||b.value||v.value!==null),A=C(()=>{if(N.value!==null)return N.value;if(_.value instanceof D){const z=_.value.invalidParameters.find(c=>c.field==="name");if(z!==void 0)return z.reason}return null});async function oe(){b.value=!0,_.value=null,T.value="";try{if(!R(d.value))return;v.value=await p.createZone({name:d.value})}catch(z){z instanceof Error?(T.value=d.value,_.value=z):console.error(z)}finally{b.value=!1}}function R(z){const c=V.test(z);return c?N.value=null:N.value=t("zones.create.invalidNameError"),c}function P(){$.value=!$.value}function te(){U.value=!0}return(z,c)=>{const se=m("RouteTitle"),S=m("KButton"),ae=m("KAlert"),le=m("KLabel"),re=m("KInput"),M=m("KRadio"),O=m("KInputSwitch"),F=m("DataSource"),ie=m("KEmptyState"),ce=m("KCard"),ue=m("KModal"),de=m("AppView"),me=m("RouteView");return l(),k(me,{name:"zone-create-view",attrs:{class:"is-fullscreen"}},{default:r(({route:X,id:G})=>[a(de,{fullscreen:!0,breadcrumbs:[]},{title:r(()=>[o("h1",null,[a(se,{title:e(t)("zones.routes.create.title")},null,8,["title"])])]),actions:r(()=>[a(S,{appearance:"tertiary","data-testid":"exit-button",onClick:()=>{w.value===""||U.value?X.back({name:"zone-cp-list-view"}):P()}},{default:r(()=>[n(s(e(t)("zones.form.exit")),1)]),_:2},1032,["onClick"])]),default:r(()=>[n(),n(),o("div",Pe,[_.value!==null?(l(),k(ae,{key:0,appearance:"danger",class:"mb-4","dismiss-type":"icon","data-testid":"create-zone-error"},{alertMessage:r(()=>[_.value instanceof e(D)&&[409,500].includes(_.value.status)?(l(),u(y,{key:0},[o("p",null,s(e(t)(`zones.create.status_error.${_.value.status}.title`,{name:T.value})),1),n(),o("p",null,s(e(t)(`zones.create.status_error.${_.value.status}.description`)),1)],64)):_.value instanceof e(D)?(l(),u("p",Me,s(e(t)("common.error_state.api_error",{status:_.value.status,title:_.value.detail})),1)):(l(),u("p",Oe,s(e(t)("common.error_state.default_error")),1))]),_:1})):E("",!0),n(),a(ce,{class:"form-card"},{default:r(()=>[o("div",Fe,[o("div",Xe,[o("div",null,[o("h1",Ge,[o("span",He,s(e(t)("zones.form.title")),1)]),n(),e(t)("zones.form.description")!==" "?(l(),u("p",Je,s(e(t)("zones.form.description")),1)):E("",!0)]),n(),e(g)("zones.form.facts").length>0?(l(),u("div",We,[o("ul",Qe,[(l(!0),u(y,null,fe(e(g)("zones.form.facts"),(i,Z)=>(l(),u("li",{key:Z,class:"fact-list__item"},[a(e(_e),{class:"fact-list__icon",color:e(H)},null,8,["color"]),n(" "+s(i),1)]))),128))])])):E("",!0)]),n(),o("div",je,[o("div",Ye,[o("h2",en,s(e(t)("zones.form.section.name.title")),1),n(),o("p",null,s(e(t)("zones.form.section.name.description")),1)]),n(),o("div",nn,[o("div",null,[a(le,{for:G,required:"","tooltip-attributes":{placement:"right"}},{tooltip:r(()=>[n(s(e(t)("zones.form.name_tooltip")),1)]),default:r(()=>[n(s(e(t)("zones.form.nameLabel"))+" ",1)]),_:2},1032,["for"]),n(),a(re,{id:G,modelValue:d.value,"onUpdate:modelValue":c[0]||(c[0]=i=>d.value=i),type:"text",name:"zone-name","data-testid":"name-input","data-test-error-type":A.value!==null?"invalid-dns-name":void 0,error:A.value!==null,"error-message":A.value??void 0,disabled:v.value!==null,onBlur:c[1]||(c[1]=i=>R(d.value))},null,8,["id","modelValue","data-test-error-type","error","error-message","disabled"])]),n(),a(S,{appearance:"primary",class:"mt-4",disabled:ne.value,"data-testid":"create-zone-button",onClick:oe},{default:r(()=>[b.value?(l(),k(e(J),{key:0,color:e(W),size:e(Q)},null,8,["color","size"])):(l(),k(e(ve),{key:1,size:e(Q)},null,8,["size"])),n(" "+s(e(t)("zones.form.createZoneButtonLabel")),1)]),_:1},8,["disabled"])])]),n(),v.value!==null?(l(),u(y,{key:0},[o("div",on,[o("div",tn,[o("h2",sn,s(e(t)("zones.form.section.configuration.title")),1),n(),o("p",null,s(e(t)("zones.form.section.configuration.description")),1)]),n(),o("div",an,[o("div",ln,[o("div",rn,[o("span",cn,s(e(t)("zones.form.environmentLabel"))+` *
                      `,1),n(),o("div",un,[a(M,{modelValue:K.value,"onUpdate:modelValue":c[2]||(c[2]=i=>K.value=i),"selected-value":"universal",name:"zone-environment","data-testid":"environment-universal-radio-button"},{default:r(()=>[n(s(e(t)("zones.form.universalLabel")),1)]),_:1},8,["modelValue"]),n(),a(M,{modelValue:K.value,"onUpdate:modelValue":c[3]||(c[3]=i=>K.value=i),"selected-value":"kubernetes",name:"zone-environment","data-testid":"environment-kubernetes-radio-button"},{default:r(()=>[n(s(e(t)("zones.form.kubernetesLabel")),1)]),_:1},8,["modelValue"])])]),n(),K.value==="kubernetes"?(l(),u(y,{key:0},[o("div",dn,[o("span",mn,s(e(t)("zones.form.zoneIngressLabel"))+` *
                        `,1),n(),o("div",pn,[a(O,{modelValue:L.value,"onUpdate:modelValue":c[4]||(c[4]=i=>L.value=i)},{label:r(()=>[n(s(e(t)("zones.form.zoneIngressEnabledLabel")),1)]),_:1},8,["modelValue"])])]),n(),o("div",_n,[o("span",fn,s(e(t)("zones.form.zoneEgressLabel"))+` *
                        `,1),n(),o("div",vn,[a(O,{modelValue:q.value,"onUpdate:modelValue":c[5]||(c[5]=i=>q.value=i)},{label:r(()=>[n(s(e(t)("zones.form.zoneEgressEnabledLabel")),1)]),_:1},8,["modelValue"])])])],64)):E("",!0)])])]),n(),o("div",bn,[o("div",zn,[o("h2",hn,s(e(t)("zones.form.section.connect_zone.title")),1),n(),o("p",null,s(e(t)("zones.form.section.connect_zone.description")),1)]),n(),o("div",gn,[a(F,{src:"/control-plane/addresses"},{default:r(({data:i})=>[typeof i<"u"?(l(),u(y,{key:0},[K.value==="universal"?(l(),k(Re,{key:0,"zone-name":d.value,token:w.value,"global-kds-address":i.kds},null,8,["zone-name","token","global-kds-address"])):(l(),k(Le,{key:1,"zone-name":d.value,"zone-ingress-enabled":L.value,"zone-egress-enabled":q.value,token:w.value,"base64-encoded-token":ee.value,"global-kds-address":i.kds},null,8,["zone-name","zone-ingress-enabled","zone-egress-enabled","token","base64-encoded-token","global-kds-address"]))],64)):E("",!0)]),_:1})])]),n(),o("div",kn,[a(F,{src:`/zone-cps/online/${d.value}?no-cache=${Y.value}`,onChange:te},{default:r(({data:i,error:Z})=>[o("div",yn,[o("h2",Cn,s(e(t)("zones.form.section.scanner.title")),1),n(),o("p",null,s(e(t)("zones.form.section.scanner.description")),1)]),n(),o("div",En,[Z?(l(),k(be,{key:0,error:Z,appearance:"danger","data-testid":"error"},null,8,["error"])):(l(),k(ie,{key:1,"cta-is-hidden":""},{title:r(()=>[typeof i>"u"?(l(),u(y,{key:0},[a(e(J),{"data-testid":"waiting",display:"inline-block",color:e(W)},null,8,["color"]),n(" "+s(e(t)("zones.form.scan.waitTitle")),1)],64)):(l(),u(y,{key:1},[a(e(ze),{"data-testid":"connected",display:"inline-block",color:e(H)},null,8,["color"]),n(" "+s(e(t)("zones.form.scan.completeTitle")),1)],64))]),message:r(()=>[typeof i<"u"?(l(),u(y,{key:0},[o("p",null,s(e(t)("zones.form.scan.completeDescription",{name:d.value})),1),n(),o("p",Kn,[a(S,{appearance:"primary",to:{name:"zone-cp-detail-view",params:{zone:d.value}}},{default:r(()=>[n(s(e(t)("zones.form.scan.completeButtonLabel",{name:d.value})),1)]),_:1},8,["to"])])],64)):E("",!0)]),_:2},1024))])]),_:1},8,["src"])])],64)):E("",!0)])]),_:2},1024)]),n(),a(ue,{visible:$.value,title:e(t)("zones.form.confirm_modal.title"),"data-testid":"confirm-exit-modal",onCancel:P,onProceed:i=>X.replace({name:"zone-cp-list-view"})},{"footer-actions":r(()=>[a(S,{appearance:"primary",to:{name:"zone-cp-list-view"},"data-testid":"confirm-exit-button"},{default:r(()=>[n(s(e(t)("zones.form.confirm_modal.action_button")),1)]),_:1})]),default:r(()=>[n(s(e(t)("zones.form.confirm_modal.body"))+" ",1)]),_:2},1032,["visible","title","onProceed"])]),_:2},1024)]),_:1})}}}),In=he(Vn,[["__scopeId","data-v-ac2b1015"]]);export{In as default};
